#ifndef __JCFF_STC_INT_H
#define __JCFF_STC_INT_H

#ifdef __cplusplus
 extern "C" {
#endif

#include "STC8.H"

/*
 * COMMON IRQ interrupt define
 * Note: IRQn in this enum, the related config registers can be access with the C51 key word "sfr".
*/
typedef enum
{
    CIRQ_EINT0_BOTH_EDGE = 0,
    CIRQ_EINT0_FALL_EDGE,
    CIRQ_EINT1_BOTH_EDGE,
    CIRQ_EINT1_FALL_EDGE,
    CIRQ_EINT2_FALL_EDGE,
    CIRQ_EINT3_FALL_EDGE,
    CIRQ_EINT4_FALL_EDGE,
    CIRQ_T0,
    CIRQ_T1,
    CIRQ_T2,
    CIRQ_T3,
    CIRQ_T4,
    CIRQ_UART1,
    CIRQ_UART2,
    CIRQ_UART3,
    CIRQ_UART4,
    CIRQ_ADC,
    CIRQ_LVD,
    CIRQ_PCA,
    CIRQ_SPI,
    CIRQ_CMP
} CIRQn_TypeDef;

/*
 * COMMON IRQ interrupt priority define
*/
typedef enum
{
    IRQ_PRIORITY_0 = 0,
    IRQ_PRIORITY_1 = 1,
    IRQ_PRIORITY_2 = 2,
    IRQ_PRIORITY_3 = 3,
} IRQ_PriorityTypeDef;


/*
 * IRQ interrupt number define
*/
#define IRQ_EINT0_HANDLER       0
#define IRQ_T0_HANDLER          1
#define IRQ_EINT1_HANDLER       2
#define IRQ_T1_HANDLER          3
#define IRQ_UART1_HANDLER       4
#define IRQ_ADC_HANDLER         5
#define IRQ_LVD_HANDLER         6
#define IRQ_PCA_HANDLER         7
#define IRQ_UART2_HANDLER       8
#define IRQ_SPI_HANDLER         9
#define IRQ_EINT2_HANDLER       10
#define IRQ_EINT3_HANDLER       11
#define IRQ_T2_HANDLER          12
#define IRQ_EINT4_HANDLER       16
#define IRQ_UART3_HANDLER       17
#define IRQ_UART4_HANDLER       18
#define IRQ_T3_HANDLER          19
#define IRQ_T4_HANDLER          20
#define IRQ_CMP_HANDLER         21
#define IRQ_PWM_HANDLER         22
#define IRQ_PWMFD_HANDLER       23
#define IRQ_IIC_HANDLER         24

/*
 * IRQ interrupt priority define
*/
#define IRQ_PRIORITY_LOW            IRQ_PRIORITY_0          //Priority is low
#define IRQ_PRIORITY_NORMAL         IRQ_PRIORITY_1          //Priority is normal          
#define IRQ_PRIORITY_HIGH           IRQ_PRIORITY_2          //Priority is high
#define IRQ_PRIORITY_VERYHIGH       IRQ_PRIORITY_3          //Priority is very high

/*
 *Extend interrupt enable flag define
*/
#define TIM2_ENABLE_BIT             0x04
#define TIM3_ENABLE_BIT             0x20
#define TIM4_ENABLE_BIT             0x40
#define UART2_ENABLE_BIT            0x01
#define UART3_ENABLE_BIT            0x08
#define UART4_ENABLE_BIT            0x10
#define SPI_ENABLE_BIT              0x02

#ifdef __cplusplus
}
#endif

#endif